from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time

testCase = "DBshop014_商品管理删除分类流程"
firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu3(firefox,'商品管理','管理分类','商品分类')
firefox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[4]/a[3]'%goodsClassName).click()
time.sleep(1)
#js弹框的处理
firefox.switch_to.alert.accept()
time.sleep(5)
#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%goodsClassName).is_displayed()
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
firefox.quit()
